home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / paslib.zip / PASLIB01.DOC < prev    next >
Text File  |  1986-05-22  |  24KB  |  507 lines

  1.  A. Introduction
  2.          The following is the documentation for the subprogram
  3.     library PASLIB01.INC which is now placed in the public
  4.     domain.
  5.  
  6.     CAVEAT:   much of this library is IBM and PC DOS specific.
  7.     It has been tested on both an IBM PC-1 and an IBM PC/AT with
  8.     monochrome, CGA, EGA, and Hercules boards but there are no
  9.     guarantees for any other machines.
  10.  
  11.          Any comments or suggestions will be appreciated.
  12.  
  13.                    Robert B. Wooster
  14.                    (203) 227-5588
  15.                    (212) 310-5222
  16.                    CIS: 72415,1602
  17.  
  18.                         Version 1 released 22 May 1986
  19.  
  20.  B. Global Declarations
  21.     1. Constants
  22.        a) IsColor
  23.                a boolean set by InitMonitor depending upon whether the
  24.                machines switches are set for monochrome or color.
  25.                Also used in SwapMonitors, q.v.
  26.        b) MaxRow, MaxCol should be self-evident
  27.        c) Video attributes:
  28.                LO_V: low video, HI_V high (or normal) video,
  29.                RE_V: reverse video
  30.        d) Special key scan codes
  31.                for the use of these constants see the functions ugetc
  32.                and NextField
  33.           1) cursor control keys
  34.              SK_HM: Home    SK_UP: up      SK_PU: PgUp
  35.              SK_LE: left                   SK_RI: right
  36.              SK_EN: End     SK_DN: down    SK_PD: PgDn
  37.              SK_IN: Ins                    SK_DE: Del
  38.           2) function keys
  39.              SK_F1 to SK_F0
  40.           3) the Esc key : E_S_C
  41.     2. Types
  42.        a) chrset
  43.        b) string80:  used as standard string type in most of the
  44.                     routines
  45.        c) bigstring: for use when string80 isn't enough
  46.        d) regtype:   fairly standard register declaration for use in
  47.                     DOS function calls
  48.        e) datetype:  a standard date type to handle dates from 1/2/60
  49.                     to 12/31/2050
  50.        f) timetype:  a standard type for handling times
  51.        g) scrntype & scrnptr: used in SaveScrn and RestoreScrn
  52.     3. Variables
  53.        a) EquipFlag: the location of the equipment flag set by POST on
  54.           IBM PCs
  55.        b) MonoScrn & ColorScrn: the addresses of the monochrome and CGA
  56.           screens
  57.        c) KeyStat: the key status byte used by the keyboard routines
  58.        d) SavedScrn: used by SaveScrn & RestoreScrn, q.v.
  59.        e) SplKey: a flag used by the keyboard input routines, q.v.
  60.        f) sdt: the current date according to the machine's clock;
  61.                initialized in InitSys
  62.        g) out: used by WhereOut, q.v.
  63.        h) To_LST: see WhereOut
  64.        i) EscFlag: see ugetc
  65.  C. Hardware control functions
  66.     1. InitMonitor    procedure
  67.        a) function:      sets IsColor flag according to the switch
  68.                          setting at EquipFlag
  69.        b) syntax:        InitMonitor;
  70.        c) returns:       nothing
  71.        d) side effects:  sets IsColor flag
  72.        e) notes:         EquipFlag is set during boot according to the
  73.                          hardware switch settings.  In a two monitor
  74.                          system this means that the monochrome monitor
  75.                          will come up.  EquipFlag can, however, be
  76.                          reset by some external programs such as Bob
  77.                          Starr's UTIL.EXE.
  78.     2. SwapMonitors   procedure
  79.        a) function:      this is to allow two monitor systems to move
  80.                          back and forth between the monochrome and
  81.                          color monitors.
  82.        b) Syntax:        SwapMonitors;
  83.        c) returns:       nothing
  84.        d) side effects:  resets EquipFlag, and IsColor to their
  85.                          opposite monitor settings
  86.        e) notes:         if you return to the Turbo editor after
  87.                          switching monitors an odd number of times,
  88.                          the results can be unpredictable, i.e. your
  89.                          machine will more or less hang.
  90.     3. SaveScrn       procedure
  91.        a) function:      saves current screen           
  92.        b) syntax:        SaveScrn
  93.        c) returns:       nothing
  94.        d) side effects:  moves screen contents to savedscrn
  95.        e) notes:         used with restorescrn
  96.        f) calls:         nothing
  97.     4. RestoreScrn    procedure
  98.        a) function:      restores saved screen           
  99.        b) syntax:        RestoreScrn
  100.        c) returns:       nothing
  101.        d) side effects:  moves saved screen to current screen
  102.        e) notes:         used with savescrn
  103.        f) calls:         nothing
  104.     5. InitSystem     procedure
  105.        a) function:      initialize system to standard
  106.                          setup           
  107.        b) syntax:        InitSystem;
  108.        c) returns:       nothing
  109.        d) side effects:  IsColor flag and sdt are set and the standard
  110.           window configuration (Sec. G) is initialized
  111.        e) notes:         See TEMPLATE.PAS for an example of its use
  112.        f) calls:         InitMonitor, InitWindows, SysDate
  113.  D. Low-level Screen I/O
  114.     1. ugetc     character function
  115.        a) function:      get a character from the keyboard without
  116.                          echo but with several side effects
  117.        b) syntax         c := ugetc;
  118.        c) returns        the character typed
  119.        d) side effects
  120.           1) if Control-C is typed the program halts
  121.           2) if a special key, i.e. a function or cursor control key, is
  122.              typed, a null character is returned and the global variable
  123.              SplKey is set to that key's scan code
  124.        e) notes:         this is the workhorse of the input functions
  125.                          discussed in section D
  126.     2. putc      procedure
  127.        a) function:      put a character on the screen with a
  128.                          specified attribute at the current cursor
  129.                          position
  130.        b) syntax         putc(c,b) where c is a character and b is an
  131.                                    attribute byte.
  132.        c) returns        nothing
  133.        d) side effects   none, but note that the cursor is not moved
  134.        e) notes:         uses direct screen addressing
  135.     3. aputc     procedure
  136.        a) function:      put a character c on the screen with
  137.                          attribute b at column x and row y
  138.        b) syntax         aputc(c,b,x,y)
  139.        c) returns        nothing
  140.        d) side effects   none, but note that the cursor is not moved
  141.        e) notes:         uses direct screen addressing
  142.  E. Data I/O
  143.     1. GetUC     character function
  144.        a) function:      get an upper case character from the
  145.                          keyboard if it is in OKSet, otherwise ring
  146.                          bell until a character in OKSet is typed
  147.        b) syntax         c := GetUC(default, OKSet)
  148.        c) returns        an upper case character
  149.        d) side effects   same as ugetc
  150.        e) notes:         useful for menu selections
  151.        f) calls:         ugetc
  152.     2. PutString procedure
  153.        a) function:      put a string on the CRT at the indicated
  154.                          position
  155.        b) syntax         PutString(s,x,y)
  156.        c) returns        nothing
  157.        d) side effects   none
  158.        e) notes:         writes a string80 but $V- parameter permits
  159.                          sending any string
  160.     3. GetString procedure
  161.        a) function:      get a string from the keyboard
  162.        b) syntax:        GetString(s1,len,x,y,s2)
  163.                               where s1 is the string returned as a
  164.                               side effect
  165.                           len is the maximum length of the string
  166.                           x,y are the screen coordinates
  167.                           s2 is the default string or ''    
  168.        c) returns:       nothing
  169.        d) side effects:  If a string has been typed it is returned in
  170.                          s1. If no string typed before a special
  171.                          function key or <Enter> is typed s2 is
  172.                          returned as s1. If a special function